home *** CD-ROM | disk | FTP | other *** search
- .Na "dbgetrow"
- .Aa
- .Fu
- Read the specified row in the row buffer.
- .Ih "row buffer, reading a row from"
- .Sy
- .Sf "STATUS dbgetrow(dbproc, row)"
- .Sp "DBPROCESS" "*dbproc"
- .Sp "DBINT" "row"
- .Co
- .Bl
- .I "dbgetrow()"
- sets the current row in the row buffer to a specific row and reads it.
- This routine only works if the DBBUFFER option is on, enabling row buffering.
- .Ih "DBBUFFER option"
- When \f2dbgetrow()\f1 is called,
- any binding of row data to program variables (as specified with \f2dbbind()\f1 or \f2dbaltbind()\f1)
- takes effect.
- .Bl
- Row buffering provides a way to keep a specified number of \*S result rows in program memory.
- Without row buffering, the result row generated by each new \f2dbnextrow()\f1 call overwrites the contents
- of the previous result row.
- Row buffering is therefore useful for programs that need to look at result rows
- in a non-sequential manner.
- It does, however, carry a memory and performance penalty because each row in the buffer
- must be allocated and freed individually.
- Therefore, use it only if you need to.
- Specifically, the application should only turn the DBBUFFER option on if it calls \f2dbgetrow()\f1.
- Note that row buffering has nothing to do with network buffering and is a completely independent issue.
- .Bl
- When row buffering is \f2not\f1 enabled,
- the application
- processes each row as it is read from the \*S, by calling
- .I "dbnextrow()"
- repeatedly until it returns NO_MORE_ROWS.
- When row buffering \f2is\f1 enabled,
- the application can use
- .I "dbgetrow()"
- to jump to any row that has already been read from the \*S with
- .I "dbnextrow()."
- Subsequent calls to
- \f2dbnextrow()\f1 cause the application to read successive rows in the buffer.
- When \f2dbnextrow()\f1 reaches the last row in the buffer, it reads rows from \*S again,
- if there are any.
- Once the buffer is full, \f2dbnextrow()\f1 does not read any more rows from \*S
- until some of the rows have been cleared from the buffer with \f2dbclrbuf()\f1.
- .Bl
- The macros \f2DBFIRSTROW()\f1, \f2DBLASTROW()\f1, and \f2DBCURROW()\f1 are useful
- in conjunction with \f2dbgetrow()\f1 calls.
- \f2DBFIRSTROW()\f1, for instance, gets the number of the first row in the buffer.
- Thus, the call:
- .ta +4n +4n +4n +4n +4n +4n
- .SD
- dbgetrow(dbproc, DBFIRSTROW(dbproc))
- .ED
- sets the current row to the first row in the buffer.
- .Bl
- For an example of row buffering, see Example 4 in the \f2\*L Reference Supplement\f1.
- .Bz
- .Pa
- .Pi dbproc
- A pointer to the DBPROCESS structure that provides the connection
- for a particular front-end/\*S process. It contains all the
- information that \*L uses to manage communications and data between the
- front end and \*S.
- .Pi row
- The
- number of the row to read.
- Rows are counted from
- the first row returned from \*S, whose number is 1.
- Note that the first row in the row buffer is not necessarily
- the first row returned from \*S.
- .in -.375i
- .Re
- .br
- \f2dbgetrow()\f1 can return four
- different types of values:
- .Bl
- If the current row is a regular row,
- REG_ROW is returned.
- .Bl
- If the current row is a compute row,
- the \f2computeid\f1 of the row is returned.
- (See \f2dbaltbind()\f1 for information on the \f2computeid\f1.)
- .Bl
- If the row is not in the row buffer,
- NO_MORE_ROWS is returned and the current row is left unchanged.
- .Bl
- If the routine was unsuccessful, FAIL is returned.
- .Bz
- .Sa
- dbaltbind,
- dbbind,
- dbclrbuf,
- DBCURROW,
- DBFIRSTROW,
- DBLASTROW,
- dbnextrow,
- options
-